package string;
/*
字符串正则表达式方法之san
String replaceAll(String regex,String str)
将当前字符串中满足正则表达式的部分替换为给定内容
 */
public class ReplaceAllDemo {
    public static void main(String[] args) {
        String str ="af2423sdfa42fas432";
        //将数字换成#NUMBER#
        str = str.replaceAll("[0-9]?","是");
        System.out.println(str);
        /*
        和谐用语
         */
        String regex ="(WDNMD|WQNMD)";
        String message = "WDNMD!WQNMD!WDNMD";
        message = message.replaceAll(regex,"***");
        System.out.println(message);
    }
}
